package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: $ {USER}
 * Date: $ {YEAR}-$ {MONTH}一$ { DAY}
 * Time: ${ TIME}
 */
public class Test {
    public static String addStrings(String num1, String num2) {
        char[] chars1 = num1.toCharArray();
        char[] chars2 = num2.toCharArray();
        long[] array1 = new long[num1.length()];
        long[] array2 = new long[num2.length()];
        for (int i = 0; i < num1.length(); i++) {
            array1[i] = chars1[i] - '0';
        }
        for (int i = 0; i < num2.length(); i++) {
            array2[i] = chars2[i] - '0';
        }
        int n1 = array1.length;
        long sum1 = 0;
        int i = 0;
        while (n1-- > 0) {
            sum1 += (long)Math.pow(10, n1)*array1[i++];
        }
        int n2 = array2.length;
        long sum2 = 0;
        i = 0;
        while (n2-- > 0) {
            sum2 += (long)Math.pow(10, n2)*array2[i++];
        }
        long sum = sum1 + sum2;
        String s = Long.toString(sum);
        return s;
    }
    public static void main(String[] args) {
        System.out.println(addStrings("9333852702227987", "85731737104263"));
    }
}
